home *** CD-ROM | disk | FTP | other *** search
-
-
-
- ppm(3) PBM Plus ppm(3)
-
-
-
- NAME
- ppm - functions to support portable pixelmap programs
-
- SYNOPSIS
- #include <ppm.h>
- cc ... libppm.a libpgm.a libpbm.a
-
-
- DESCRIPTION
- TYPES AND CONSTANTS
-
- typedef gray pixval;
- #define PGM_MAXMAXVAL 255
- typedef struct
- {
- pixval r, g, b;
- } pixel;
- extern pixval ppm_pbmmaxval;
-
- Each _p_i_x_v_a_l should contain only the values between _0 and
- _P_G_M__M_A_X_M_A_X_V_A_L. _p_p_m__p_b_m_m_a_x_v_a_l is the maxval used when a PPM
- program reads a PBM file. Normally it is 1; however, for
- some programs, a larger value gives better results.
-
- PIXEL MANIPULATIONS
-
- pixval PPM_GETR(p)
- pixel p;
-
- pixval PPM_GETG(p)
- pixel p;
-
- pixval PPM_GETB(p)
- pixel p;
-
- These three macros retrieve the red, green or blue value
- from the given pixel.
-
- void PPM_ASSIGN(p,red,grn,blu)
- pixel p;
- pixval red, grn, blu;
-
- This macro assigns the given red, green and blue values to
- the pixel.
-
- int PPM_EQUAL(p,q)
- pixel p, q;
-
- This macro checks two pixels for equality.
-
- void PPM_CSCALE(newp, p, oldmaxval, newmaxval)
- pixel newp, p;
-
-
-
- Printed 5/25/90 1
-
-
-
-
-
-
- ppm(3) PBM Plus ppm(3)
-
-
-
- pixval oldmaxval, newmaxval;
-
- This macro scales the colors of pixel _p according the old
- and new maximum values and assigns the new values to _n_e_w_p.
- It is intended to make writing ppmtowhatever easier.
-
- double PPM_LUMIN(p)
- pixel p;
-
- This macro determines the luminance of the pixel _p.
-
- PGM MEMORY MANAGEMENT
-
- pixel **pgm_allocarray(int cols, int rows)
-
- Allocate an array of pixels.
-
- pixel *pgm_allocrow( int cols )
-
- Allocate a row of the given number of pixels.
-
- void pgm_freearray( pixelrow, rows )
-
- Free the array allocated with _p_g_m__a_l_l_o_c_a_r_r_a_y() containing
- the given number of rows.
-
- pbm_freerow( pixelrow )
-
- Free a row of pixels.
-
- READING PBM FILES
-
- void
- ppm_readppminit( file, colsP, rowsP, maxvalP, formatP )
- FILE *file;
- int *colsP, *rowsP, *formatP;
- pixval *maxvalP;
-
- Read the header from a pgm file, filling in the rows, cols,
- maxval and format variables.
-
- void
- ppm_readppmrow( file, pixelrow, cols, maxval, format )
- FILE *file;
- pixel *pixelrow;
- pixval maxval;
- int cols, format;
-
- Read a row of pixels into the pixelrow array. Format and
- cols were filled in by _p_p_m__r_e_a_d_p_p_m_i_n_i_t().
-
- pixel **
-
-
-
- Printed 5/25/90 2
-
-
-
-
-
-
- ppm(3) PBM Plus ppm(3)
-
-
-
- ppm_readppm( file, colsP, rowsP, maxvalP )
- FILE *file;
- int *colsP, *rowsP;
- pixval *maxvalP;
-
- Read an entire pixelmap file into memory, returning the
- allocated array and filling in the rows, cols and maxval
- variables. This function combines _p_p_m__r_e_a_d_p_p_m_i_n_i_t(),
- _p_p_m__a_l_l_o_c_a_r_r_a_y() and _p_p_m__r_e_a_d_p_p_m_r_o_w().
-
- WRITING PGM FILES
-
- void
- ppm_writeppminit( file, cols, rows, maxval )
- FILE *file;
- int cols, rows;
- pixval maxval;
-
- Write the header for a portable pixelmap file.
-
- void
- ppm_writeppmrow( file, pixelrow, cols, maxval )
- FILE *file;
- pixel *pixelrow;
- int cols;
- pixval maxval;
-
- Write a row from a portable pixelmap.
-
- void
- ppm_writeppm( file, bits, cols, rows, maxval )
- FILE *file;
- pixel **bits;
- int cols, rows;
- pixval maxval;
-
- Write the header and all data for a portable pixelmap. This
- function combines _p_p_m__w_r_i_t_e_p_p_m_i_n_i_t() and _p_p_m__w_r_i_t_e_p_p_m_r_o_w().
-
- pixel ppm_backgroundpixel(pixels, cols, rows)
- pixel **pixels;
- int cols;
- int rows;
-
- Intuit the value of the background.
-
- SEE ALSO
- pgm(3), ppm(3)
-
- AUTHOR
- Manual by Tony Hansen.
-
-
-
-
- Printed 5/25/90 3
-
-
-
-
-
-
- ppm(3) PBM Plus ppm(3)
-
-
-
- Copyright (C) 1989 by Jef Poskanzer.
-
- Permission to use, copy, modify, and distribute this
- software and its documentation for any purpose and without
- fee is hereby granted, provided that the above copyright
- notice appear in all copies and that both that copyright
- notice and this permission notice appear in supporting docu-
- mentation. This software is provided "as is" without
- express or implied warranty.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Printed 5/25/90 4
-
-
-
-